package cn.qingyun.gis.modules.caronline.controller;

import cn.qingyun.gis.common.Result;
import cn.qingyun.gis.modules.caronline.service.ICarProofreadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Api(tags = "网约车-初始化")
@RestController
@RequestMapping("/car/data/")
@Slf4j
public class CarDataInitController {
    @Resource
    private ICarProofreadService iCarProofreadService;
    @ApiOperation(value = "初始化网约车信息表")
    @PostMapping("/initCarExcel")
    public Result<?> initCarExcel(@RequestParam("file") MultipartFile file) {
        iCarProofreadService.initCarExcel(file);
        return Result.okData("正在初始化网约车站点数据, 请稍后");
    }

    @ApiOperation(value = "网约车信息主副表格式化")
    @GetMapping("/formatting")
    public Result<?> formatting() {
        iCarProofreadService.formatting();
        return Result.okData("正在格式化网约车站点数据, 请稍后");
    }

    @ApiOperation(value = "根据工号权限导出全量网约车地址数据")
    @GetMapping("/exportCarTotal")
    public Result<?> exportCarTotal(HttpServletRequest request) {
        iCarProofreadService.exportCarTotal(request);
        return Result.okData("正在导出网约车全量地址数据, 请稍后");
    }
}
